﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Argotic.Common;
using System.Xml.XPath;
using Argotic.Data.Adapters;
using Argotic.Syndication;
using HtmlAgilityPack;
using System.Text.RegularExpressions;

namespace MyPublish.Connection.Syndication
{
    [DataConnectionProvider(Name = "Rss", Type = typeof(RssConnectionProvider))]
    public class RssConnectionProvider : DataConnectionProvider
    {
        public override IEnumerable<object> ExecuteQuery()
        {
            throw new NotSupportedException();
        }

        public override IEnumerable<object> ExecuteQuery(object data)
        {
            string url = data as string;
            RssFeedContext context = RssFeedContext.Create(url);
            foreach (PostData postData in context.Posts)
            {
                yield return postData;
            }
        }
    }
}
